package com.dzsw.mybatisx.generate.util;

import org.yaml.snakeyaml.Yaml;

import java.io.FileInputStream;

public class YamlUtil {

    public static GenConf readGenConfYaml() throws Exception {
        Yaml yaml = new Yaml();
        String fileName = ClassLoader.getSystemResource("application.yml").getPath();
        GenConf genConf = yaml.loadAs(new FileInputStream(fileName), GenConf.class);
        return genConf;
    }

    public static void main(String[] args) throws Exception {
        Yaml yaml = new Yaml();
        String fileName = ClassLoader.getSystemResource("application.yml").getPath();
        GenConf genConf = yaml.loadAs(new FileInputStream(fileName), GenConf.class);
        System.out.println(genConf.getAuthor());
    }
}
